

/* Analysis of "No Gender Bias in Audience Perceptions of Male and Female Experts in the News: Equally Competent and Persuasive"
Published in International Journal of Press/Politics
Code written for Stata 16
Corresponding author: Frederik Kjøller Larsen, fkl@ifs.ku.dk
*/


**********************************
***Installing required packages***
**********************************
*ssc install estout //Run this line if estout is not already installed (used when creating regression tables)
*net install grc1leg, from(http://www.stata.com/users/vwiggins) //Run this line if grc1leg is not already installed (used when combining graphs)
*ssc install coefplot //Run this line if "Coefplot" is not already installed (used when plotting results in graphs)
*ssc install blindschemes //Run this line if "blindschemes is not already installed (used to control graph layout) 
*net install tost // from(https://alexisdinno.com/stata) run this line if tost is not already installed (used to calculate test of equivalences)

*******************************
***Setting the figure scheme***
*******************************
set scheme plottig
graph set window fontface "Perpetua" /// setting "perpetua" as the graph font 

**********************
***Getting the data***
**********************
clear all
set more off, permanently

*set directory and import raw data - depends on location	
	cd "C:\no_gender_bias" 
	use "rawdata_no_gender_bias.dta", clear
		

*************************
***Setting up the data***
*************************

*Background variables
	*Gender
	recode gender (1=1 "Female") (2=0 "Male"), gen(female)
	label define respondent_gender 0 "Male respondent" 1 "Female Respondent"
	label values female respondent_gender

	*Education
	tab profile_education_recode
	label define education 1 "Grundskole" 2 "Gym" 3 "EUD" 4 "KVU" 5 "MVU" 6 "LVU"
	label values profile_education_recode education
	recode profile_education_recode (1 2=1 "High School or less") (3=2 "Vocational") (4 5 6=3 "Some college" ), gen(edu3)
	
	*Occupation
	tab occupation2 
	recode occupation2 (1 2 5 6 7=1 "Blue Collar") (3 4 8=2 "White Collar") (9=3 "Student/Intern") (11=4 "Retired") (12 13=5 "Unempl./Other"), gen(occu5)
	tab occu5
	

*Experiments*
	gen experiment=.
	recode experiment (.=1) if q2aa_1!=. | q2ab_1!=.  
	recode experiment (.=2) if q2ba_1!=. | q2bb_1!=.
	label define experiment_label 1 "Entrepreneur" 2 "Euthanasia"
	label values experiment experiment_label

*Condition*
	gen condition=.
	recode condition (.=1) if q2aa_1!=. | q2ba_1!=. 
	recode condition (.=2) if q2ab_1!=. | q2bb_1!=.
	label define gender_label 0 "Control" 1 "Male" 2 "Female" 
	label values condition gender_label
	
*Experimental condition - used to calculate effect sizes*
		gen entrepreneurship_gender=0
		recode entrepreneurship_gender (0=1) if  q2aa_1!=.
		recode entrepreneurship_gender (0=2) if  q2ab_1!=.
		label values entrepreneurship_gender gender_label
			recode entrepreneurship_gender (2=1), gen(entre_control_vs_gender)
		
		gen euthanasia_gender=0 
		recode euthanasia_gender (0=1) if  q2ba_1!=.
		recode euthanasia_gender (0=2) if  q2bb_1!=.
		label values euthanasia_gender gender_label
			recode euthanasia_gender (2=1), gen(eutha_control_vs_gender)

*Items and scale on euthanasia*
	
	*Opinion
	gen legal=max(q1a_1, q3b_1) //collapsing variables from different conditions
	recode legal (977=.) //removing don't knows

	gen painrelief=max(q1a_2, q3b_2) //collapsing variables from different conditions 
	recode painrelief (977=.) //removing don't knows

	gen dignity=max(q1a_3, q3b_3) //collapsing variables from different conditions
	recode dignity (977=.) //removing don't knows

	gen pressure=max(q1a_4, q3b_4) //collapsing variables from different conditions
	recode pressure (977=.) //removing don't knows

	alpha legal painrelief dignity pressure, item std gen(unstandardized_euthanasia_scale)
	egen uns_euthanasia_scale_min=min(unstandardized_euthanasia_scale) //the lines are used to standardize the measure to 0-1
	egen uns_euthanasia_scale_max=max(unstandardized_euthanasia_scale)
	gen euthanasia_scale=(unstandardized_euthanasia_scale - uns_euthanasia_scale_min )/(uns_euthanasia_scale_max - uns_euthanasia_scale_min)
	drop unstandardized_euthanasia_scale uns_euthanasia_scale_min uns_euthanasia_scale_max

	*Competence assessment
	gen euthansia_intelligent=max(q2bb_1, q2ba_1) //collapsing variables from different conditions
	recode euthansia_intelligent (5 = 1) (4 = 2) (2 = 4) (1 = 5) (977=.) //turning scale around so higher score means more positive assesment and removing don't knows
	
	gen euthansia_competent=max(q2ba_2, q2bb_2) //collapsing variables from different conditions
	recode euthansia_competent (5 = 1) (4 = 2) (2 = 4) (1 = 5) (977=.) //turning scale around so higher score means more positive assesment and removing don't knows
	
	gen euthansia_reliable=max(q2ba_3, q2bb_3) //collapsing variables from different conditions
	recode euthansia_reliable (5 = 1) (4 = 2) (2 = 4) (1 = 5) (977=.) //turning scale around so higher score means more positive assesment and removing don't knows
	
	gen euthansia_knowledgable=max(q2ba_4, q2bb_4) //collapsing variables from different conditions
	recode euthansia_knowledgable (5 = 1) (4 = 2) (2 = 4) (1 = 5) (977=.) //turning scale around so higher score means more positive assesment and removing don't knows
	
	alpha euthansia_intelligent euthansia_competent euthansia_reliable euthansia_knowledgable, item std gen(uns_euthanasia_competence_scale)
	egen uns_eutha_competence_scale_min=min(uns_euthanasia_competence_scale) //the lines are used to standardize the measure to 0-1
	egen uns_eutha_competence_scale_max=max(uns_euthanasia_competence_scale)
	gen euthanasia_competence_scale=(uns_euthanasia_competence_scale - uns_eutha_competence_scale_min )/(uns_eutha_competence_scale_max - uns_eutha_competence_scale_min)
	drop uns_euthanasia_competence_scale uns_eutha_competence_scale_min uns_eutha_competence_scale_max
	
*Items and scale on entrepreneurship*
	
	*Opinion
	
	gen taxes=max(q1b_1, q3a_1) //collapsing variables from different conditions
	recode taxes (977=.) //removing don't knows
	
	gen jobcreation=max(q1b_2, q3a_2) //collapsing variables from different conditions
	recode jobcreation (977=.) //removing don't knows
	
	gen borrow=max(q1b_3, q3a_3) //collapsing variables from different conditions
	recode borrow (977=.) //removing don't knows
	
	gen maintainjobs=max(q1b_4, q3a_4) //collapsing variables from different conditions
	recode maintainjobs (977=.) //removing don't knows

	alpha taxes jobcreation borrow maintainjobs, item std gen(uns_entrepreneurship_scale)
	egen uns_entrepreneurship_scale_min=min(uns_entrepreneurship_scale) //the lines are used to standardize the measure to 0-1
	egen uns_entrepreneurship_scale_max=max(uns_entrepreneurship_scale)
	gen entrepreneurship_scale=(uns_entrepreneurship_scale - uns_entrepreneurship_scale_min )/(uns_entrepreneurship_scale_max - uns_entrepreneurship_scale_min)
	drop uns_entrepreneurship_scale uns_entrepreneurship_scale_min uns_entrepreneurship_scale_max
	
	*Competence assessment
	gen entrepreneurship_intelligent=max(q2aa_1, q2ab_1) //collapsing variables from different conditions
	recode entrepreneurship_intelligent (5 = 1) (4 = 2) (2 = 4) (1 = 5) (977=.) //turning scale around so higher score means more positive assesment and removing don't knows
	
	gen entrepreneurship_competent=max(q2aa_2, q2ab_2) //collapsing variables from different conditions
	recode entrepreneurship_competent (5 = 1) (4 = 2) (2 = 4) (1 = 5) (977=.) //turning scale around so higherscore means more positive assesment and removing don't knows
	
	gen entrepreneurship_reliable=max(q2aa_3, q2ab_3) //collapsing variables from different conditions
	recode entrepreneurship_reliable (5 = 1) (4 = 2) (2 = 4) (1 = 5) (977=.) //turning scale around so higher score means more positive assesment and removing don't knows
	
	gen entrepreneurship_knowledgable=max(q2aa_4, q2ab_4) //collapsing variables from different conditions
	recode entrepreneurship_knowledgable (5 = 1) (4 = 2) (2 = 4) (1 = 5) (977=.) //turning scale around so higher score means more positive assesment and removing don't knows

	alpha entrepreneurship_intelligent entrepreneurship_competent entrepreneurship_reliable entrepreneurship_knowledgable, item std gen(uns_entre_competence_scale)
	egen uns_entre_competence_scale_min=min(uns_entre_competence_scale) //the lines are used to standardize the measure to 0-1
	egen uns_entre_competence_scale_max=max(uns_entre_competence_scale)
	gen entrepreneur_competence_scale=(uns_entre_competence_scale - uns_entre_competence_scale_min )/(uns_entre_competence_scale_max - uns_entre_competence_scale_min)
	drop uns_entre_competence_scale uns_entre_competence_scale_min uns_entre_competence_scale_max
	
	
***************************************************************************************************************************************************************************************
***ANALYSES****************************************************************************************************************************************************************************
***************************************************************************************************************************************************************************************

************************************
***Respondent Descriptives**********
************************************

tab disposition // completion rate was 90%
tab Article_group_AB disposition, chi //no significant differences in completion across conditions
tab Article_group_CD disposition, chi //no significant differences in completion across conditions
tab disposition if Article_group_AB!=. |  Article_group_CD!=.   // after exposure to stimuli, just 5,9% drop out rate
drop if disposition==0 //We limit the analyses to respondents completing the entire survey

** Descriptives of background
* continious variables
gen gender_desc=gender-1 //(create a 0-1 dummy)
sum gender_desc, detail
sum age, detail

* Categorical variables
codebook occu5, tab(100)
codebook edu3, tab(100)
codebook age_grp, tab(100)

*Graphical
tab1 gender age_grp edu3 occu5
hist age, w(1) freq
graph bar, over(occu5)
graph bar, over(edu3)
graph bar, over(age_grp)


**Descriptives of outcome variables -- for table A10 in Online Supplementary Information File
sum euthanasia_competence_scale, detail
sum euthanasia_scale, detail
sum entrepreneur_competence_scale, detail
sum entrepreneurship_scale, detail

* Density plots of outcomes -- 	Figure A10 and A11 in Online Supplementary Information File
kdensity euthanasia_competence_scale, bw(0.03) title("Euthansia Experiment", size(large)) xtitle("") legend(off) ///
ylabel(, labsize(large) labcolor(black)) xlabel(, labsize(large) labcolor(black)) ///
ytitle(, size(large) color(black)) xtitle(, size(large) color(black)) note(,size(medsmall))
graph save density_eutha_comp.gph, replace

kdensity euthanasia_scale, bw(0.03) title("Euthanasia Experiment", size(large)) xtitle("") legend(off) ///
ylabel(, labsize(large) labcolor(black)) xlabel(, labsize(large) labcolor(black)) ///
ytitle(, size(large) color(black)) xtitle(, size(large) color(black)) note(,size(medsmall))
graph save density_eutha_att.gph, replace

kdensity entrepreneur_competence_scale, bw(0.03) title("Entrepreneurship Experiment", size(large)) xtitle("") legend(off) ///
ylabel(, labsize(large) labcolor(black)) xlabel(, labsize(large) labcolor(black)) ///
ytitle(, size(large) color(black)) xtitle(, size(large) color(black)) note(,size(medsmall))
graph save density_entre_comp.gph, replace

kdensity entrepreneurship_scale, bw(0.03) title("Entrepreneurship Experiment", size(large)) xtitle("") legend(off) ///
ylabel(, labsize(large) labcolor(black)) xlabel(, labsize(large) labcolor(black)) ///
ytitle(, size(large) color(black)) xtitle(, size(large) color(black)) note(,size(medsmall))
graph save density_entre_att.gph, replace

************************************
***Manipulation check***************
************************************

tab q4b euthanasia_gender, chi col //A clear majority of respondents had correct recall of expert gender
tab q4a entrepreneurship_gender, chi col //A clear majority of respondents had correct recall of expert gender

*********************************************
***** ANALYSES ON COMPETENCE ASSESSMENT *****
*********************************************



	****************************************
	*** Euthanasia competence assessment ***
	****************************************

*Main effect*
reg euthanasia_competence_scale i.euthanasia_gender
eststo main_eutha_comp
margins, over(euthanasia_gender) pwcompare //
	*Graph
		estimates restore main_eutha_comp
		margins, at(euthanasia_gender=1) post
		eststo eu_comp_m1
		estimates restore main_eutha_comp
		margins, at(euthanasia_gender=2) post
		eststo eu_comp_m2
		coefplot(eu_comp_m1, label(Male expert) msymbol(circle) color(black) ciopts(color(black))) ///
				(eu_comp_m2, label(Female expert) msymbol(circle_hollow) color(black) ciopts(color(black))) ///
				, vert legend(rows(1) position(6)) msize(vlarge) ///
				title("Euthanasia Experiment", size(large)) ytitle("Competence of Expert", size(large)) xtitle(" ") ///
				coeflabels(, nolabel notick) ylabel(, labsize(large) labcolor(black)) level(95)
				graph save  eutha_comp_main.gph, replace 

			
				
	*Age as moderator*
	reg euthanasia_competence_scale ib1.euthanasia_gender##c.age //no significant interaction with respondent age (male expert as reference category)
	estimates store age_eutha_comp
	margins, dydx(euthanasia_gender) at(age=(20(1)80))   //difference between attitude after exposure to male vs. female expert is insignificant for all ages
		*Graph
		estimate restore age_eutha_comp
		margins, at (age=(20(5)80) euthanasia_gender=(1)) post
		eststo eu_comp_a1
		estimate restore age_eutha_comp
		margins, at (age=(20(5)80) euthanasia_gender=(2)) post
		eststo eu_comp_a2
		coefplot(eu_comp_a1, label(Male expert) msymbol(circle) color(black) ciopts(color(black))) ///
				(eu_comp_a2, label(Female expert) msymbol(circle_hollow) color(black) ciopts(color(black))) ///
				, vert legend(rows(1) position(12)) msize(large) ///
				title("Euthanasia Experiment", size(large)) ytitle("Competence of Expert", size(large)) xtitle("Age (20-80 years)", size(large) color(black)) ///
				coeflabels(, notick nolabels) ylabel(, labsize(large) labcolor(black)) level(95)
				graph save  eutha_comp_age.gph, replace 
	
								
		*Additional check: non-linear effects of age
		reg euthanasia_competence i.euthanasia_gender##i.age_grp
		estimates store agegrp_comp_eutha
		margins, dydx(euthanasia_gender) at(age_grp=(1 2 3 4)) //difference between attitude after exposure to male vs. female expert is insignificant for all age groups
			*Graph
			estimate restore agegrp_comp_eutha
			margins, at (age_grp=(1 2 3 4) euthanasia_gender=(1)) post
			eststo eu_c_ag1
			estimate restore agegrp_comp_eutha
			margins, at (age_grp=(1 2 3 4) euthanasia_gender=(2)) post
			eststo eu_c_ag2
			
			coefplot(eu_c_ag1, label(Male expert) msymbol(circle) color(black) ciopts(color(black))) ///
					(eu_c_ag2, label(Female expert) msymbol(circle_hollow) color(black) ciopts(color(black))) ///
					, vert legend(rows(1) position(12))  msize(large) ///
					title("Euthanasia Experiment", size(large)) ytitle("Competence of Expert", size(large)) xtitle("Age groups", size(large) color(black)) ///
					coeflabels(1._at="18-34" 2._at="35-49" 3._at="50-64" 4._at="65+", labsize(large) labcolor(black)) ylabel(.5(0.05).7, labsize(large) labcolor(black)) level(95)
					graph save  eutha_comp_agegrp.gph, replace 
								


	*Gender as moderator*	
	reg euthanasia_competence_scale ib1.euthanasia_gender##i.female //no significant interaction with respondent gender (male expert as reference category)
	estimates store gender_eutha_comp
	margins, dydx(euthanasia_gender) at(female=(0 1)) // difference between male expert ("1.euthanasia_gender") and female expert (2.euthanasia_gender ) insignificant for men ("female=0) and women ("female=1")
		*Graph
		estimates restore gender_eutha_comp
		margins, at(female=(0 1) euthanasia_gender=(1) ) post
		eststo eu_comp_g1
		estimates restore gender_eutha_comp
		margins, at(female=(0 1) euthanasia_gender=(2) ) post
		eststo eu_comp_g2
		
		coefplot(eu_comp_g1, label(Male expert) msymbol(circle) color(black) ciopts(color(black))) ///
				(eu_comp_g2, label(Female expert) msymbol(circle_hollow) color(black) ciopts(color(black))) ///
				, vert order(1._at . 2._at) legend(rows(1) position(12)) msize(vlarge) ///
				title("Euthanasia Experiment", size(large)) ytitle("Competence of Expert", size(large)) ///
				coeflabels( 1._at = `""Male" respondent""' 2._at=`""Female" "respondent""' ,labsize(large) labcolor(black)) level(95) ylabel(, labsize(large) labcolor(black))
				graph save  eutha_comp_gender.gph, replace 
		
	
	*Education as moderator
	reg euthanasia_competence_scale ib1.euthanasia_gender##i.edu3 //no significant interaction with respondent education (male expert as reference category)
	estimates store edu_eutha_comp
	margins, dydx(euthanasia_gender) at(edu3=(1 2 3)) //difference between attitude after exposure to male vs. female expert is insignificant for all levels of education
		*Graph
		estimates restore edu_eutha_comp
		margins, at(edu3=(1 2 3) euthanasia_gender=(1) ) post
		eststo eu_comp_ed1
		estimates restore edu_eutha_comp
		margins, at(edu3=(1 2 3) euthanasia_gender=(2) ) post
		eststo eu_comp_ed2
		coefplot(eu_comp_ed1, label(Male expert) msymbol(circle) color(black) ciopts(color(black))) ///
				(eu_comp_ed2, label(Female expert) msymbol(circle_hollow) color(black) ciopts(color(black))) ///
				, vert order(1._at . 2._at . 3._at) legend(rows(1) position(12)) msize(vlarge) ///
				title("Euthanasia Experiment", size(large)) ytitle("Competence of Expert", size(large)) ///
				coeflabels( 1._at = `""High school" "or less""' 2._at="Vocational" 3._at= `""Some" "College""' , labsize(large) labcolor(black)) ylabel(, labsize(large) labcolor(black))  level(95)
				graph save  eutha_comp_edu.gph, replace 
	
	
	*Occupation as moderator
	reg euthanasia_competence_scale ib1.euthanasia_gender##i.occu5 //no significant interaction with occupation gender (male expert as reference category)
	estimates store occu5_eutha_comp
	margins, dydx(euthanasia_gender) at(occu5=(1 2 3 4 5)) //Difference between attitude after exposure to male vs. female expert is insignifikant for all occupational groups
		*Graph
		estimates restore occu5_eutha_comp
		margins, at(occu5=(1 2 3 4 5) euthanasia_gender=(1) ) post
		eststo eu_comp_oc1
		estimates restore occu5_eutha_comp
		margins, at(occu5=(1 2 3 4 5) euthanasia_gender=(2) ) post
		eststo eu_comp_oc2
		coefplot(eu_comp_oc1, label(Male expert) msymbol(circle) color(black) ciopts(color(black))) ///
			(eu_comp_oc2, label(Female expert) msymbol(circle_hollow) color(black) ciopts(color(black))) ///
			, vert order(1._at . 2._at . 3._at . 4._at . 5._at) legend(rows(1) position(12)) msize(vlarge) ///
			title("Euthanasia Experiment", size(large)) ytitle("Competence of Expert", size(large)) ///
			coeflabels( 1._at = `""Blue" "collar""' 2._at=`""White" "collar""' 3._at= `""Student/" "Intern""' 4._at= "Retired" 5._at= `""Unempl./" "Other""' ,  labsize(medlarge) labcolor(black)) ///
			ylabel(, labsize(large) labcolor(black)) level(95)
			graph save  eutha_comp_occu.gph, replace	
	
	
	**********************************************
	*** Entrepreneurship competence assessment ***
	**********************************************

reg entrepreneur_competence_scale i.entrepreneurship_gender
eststo main_entr_comp
margins, over(entrepreneurship_gender) pwcompare //
	*Graph
	estimates restore main_entr_comp
	margins, at(entrepreneurship_gender=1) post
	eststo en_comp_m1
	estimates restore main_entr_comp
	margins, at(entrepreneurship_gender=2) post
	eststo en_comp_m2
	coefplot(en_comp_m1, label(Male expert) msymbol(circle) color(black) ciopts(color(black))) ///
			(en_comp_m2, label(Female expert) msymbol(circle_hollow) color(black) ciopts(color(black))) ///
			, vert legend(rows(1) position(12)) msize(vlarge) ///
			title("Entrepreneurship Experiment", size(large)) ytitle("Competence of Expert", size(large)) xtitle(" ") ///
			coeflabels(, nolabel notick)  ylabel(, labsize(large) labcolor(black)) level(95)
			graph save  entre_comp_main.gph, replace 

			
	*Age as moderator*
	reg entrepreneur_competence_scale ib1.entrepreneurship_gender##c.age //no significant interaction with respondent age (male expert as reference category)
	estimates store age_entre_comp
	margins, dydx(entrepreneurship_gender) at(age=(20(1)80))   //difference between attitude after exposure to male vs. female expert is insignificant for all ages
		*Graph
		estimate restore age_entre_comp
		margins, at (age=(20(5)80) entrepreneurship_gender=(1)) post
		eststo en_comp_a1
		estimate restore age_entre_comp
		margins, at (age=(20(5)80) entrepreneurship_gender=(2)) post
		eststo en_comp_a2
		coefplot(en_comp_a1, label(Male expert) msymbol(circle) color(black) ciopts(color(black))) ///
				(en_comp_a2, label(Female expert) msymbol(circle_hollow) color(black) ciopts(color(black))) ///
				, vert legend(rows(1) position(12)) msize(large) ///
				title("Entrepreneurship Experiment", size(large)) ytitle("Competence of Expert", size(large)) xtitle("Age (20-80 years)", size(large) color(black)) ///
				coeflabels(, notick nolabels) ylabel(, labsize(large) labcolor(black)) level(95)
				graph save  entre_comp_age.gph, replace 
					
					
				
		*Additional check: non-linear effects of age
		reg entrepreneur_competence i.entrepreneurship_gender##i.age_grp
		estimates store agegrp_comp_enter
		margins, dydx(entrepreneurship_gender) at(age_grp=(1 2 3 4)) //difference between attitude after exposure to male vs. female expert is insignificant for all age groups
			*Graph
			estimate restore agegrp_comp_enter
			margins, at (age_grp=(1 2 3 4) entrepreneurship_gender=(1)) post
			eststo en_c_ag1
			estimate restore agegrp_comp_enter
			margins, at (age_grp=(1 2 3 4) entrepreneurship_gender=(2)) post
			eststo en_c_ag2
			
			coefplot(en_c_ag1, label(Male expert) msymbol(circle) color(black) ciopts(color(black))) ///
					(en_c_ag2, label(Female expert) msymbol(circle_hollow) color(black) ciopts(color(black))) ///
					, vert legend(rows(1) position(12))  msize(large) ///
					title("Entrepreneur Experiment", size(large)) ytitle("Competence of Expert", size(large)) xtitle("Age groups") ///
					coeflabels(1._at="18-34" 2._at="35-49" 3._at="50-64" 4._at="65+" , labsize(large) labcolor(black)) ylabel(.5(0.05).7, labsize(large) labcolor(black)) level(95)
					graph save  entre_comp_agegrp.gph, replace 
								
	
	
	*Gender as moderator*			
	reg entrepreneur_competence_scale ib1.entrepreneurship_gender##i.female //no significant interaction with respondent gender (male expert as reference category)
	estimates store gender_entre_comp
	margins, dydx(entrepreneurship_gender) at(female=(0 1)) // difference between male expert ("1.entrepreneurship_gender") and female expert (2.entrepreneurship_gender ) insignificant for men ("female=0) and women ("female=1")
		*Graph
		estimates restore gender_entre_comp
		margins, at(female=(0 1) entrepreneurship_gender=(1) ) post
		eststo en_comp_g1
		estimates restore gender_entre_comp
		margins, at(female=(0 1) entrepreneurship_gender=(2) ) post
		eststo en_comp_g2
		
		coefplot(en_comp_g1, label(Male expert) msymbol(circle) color(black) ciopts(color(black))) ///
				(en_comp_g2, label(Female expert) msymbol(circle_hollow) color(black) ciopts(color(black))) ///
				, vert order(1._at . 2._at) legend(rows(1) position(12)) msize(vlarge) ///
				title("Entrepreneurship Experiment", size(medlarge)) ytitle("Competence of Expert", size(large)) ///
				coeflabels( 1._at = `""Male" "respondent""' 2._at=`""Female" "respondent""', labsize(large) labcolor(black)) ylabel(, labsize(large) labcolor(black)) level(95)
				graph save  entre_comp_gender.gph, replace 
	
	
	*Education as moderator
	reg entrepreneur_competence_scale ib1.entrepreneurship_gender##i.edu3 //no significant interaction with respondent education (male expert as reference category)
	estimates store edu_entre_comp
	margins, dydx(entrepreneurship_gender) at(edu3=(1 2 3)) //difference between attitude after exposure to male vs. female expert is insignificant for all levels of education
		*Graph
		estimates restore edu_entre_comp
		margins, at(edu3=(1 2 3) entrepreneurship_gender=(1) ) post
		eststo en_comp_ed1
		estimates restore edu_entre_comp
		margins, at(edu3=(1 2 3) entrepreneurship_gender=(2) ) post
		eststo en_comp_ed2
		coefplot(en_comp_ed1, label(Male expert) msymbol(circle) color(black) ciopts(color(black))) ///
				(en_comp_ed2, label(Female expert) msymbol(circle_hollow) color(black) ciopts(color(black))) ///
				, vert order(1._at . 2._at . 3._at) legend(rows(1) position(12)) msize(vlarge) ///
				title("Entrepreneurship Experiment", size(medlarge)) ytitle("Competence of Expert", size(large)) ///
				coeflabels( 1._at = `""High school" "or less""' 2._at="Vocational" 3._at= `""Some" "College""' , labsize(large) labcolor(black))  ylabel(, labsize(large) labcolor(black)) level(95)
				graph save  entre_comp_edu.gph, replace 
	
	
	*Occupation as moderator
	reg entrepreneur_competence_scale ib1.entrepreneurship_gender##i.occu5 //no significant interaction with occupation gender (male expert as reference category)
	estimates store occu5_entre_comp
	margins, dydx(entrepreneurship_gender) at(occu5=(1 2 3 4 5)) //Difference between attitude after exposure to male vs. female expert is insignifikant for all occupational groups
		*Graph
		estimates restore occu5_entre_comp
		margins, at(occu5=(1 2 3 4 5) entrepreneurship_gender=(1) ) post
		eststo en_comp_oc1
		estimates restore occu5_entre_comp
		margins, at(occu5=(1 2 3 4 5) entrepreneurship_gender=(2) ) post
		eststo en_comp_oc2
		coefplot(en_comp_oc1, label(Male expert) msymbol(circle) color(black) ciopts(color(black))) ///
				(en_comp_oc2, label(Female expert) msymbol(circle_hollow) color(black) ciopts(color(black))) ///
				, vert order(1._at . 2._at . 3._at . 4._at . 5._at) legend(rows(1) position(12)) msize(vlarge) ///
				title("Entrepreneurship Experiment", size(medlarge)) ytitle("Competence of expert", size(large)) ///
				coeflabels( 1._at = `""Blue" "collar""' 2._at=`""White" "collar""' 3._at= `""Student/" "Intern""' 4._at= "Retired" 5._at= `""Unempl./" "Other""' ,  labsize(medlarge) labcolor(black)) ///
				ylabel(, labsize(large) labcolor(black)) level(95)
				graph save  entre_comp_occu.gph, replace	




***************************************
***** ANALYSES ON POLICY OPINIONS *****
***************************************
			
	*********************************************
	*** Euthanasia experiment: Policy opinion ***
	*********************************************

*Gendered attitude effect*
reg euthanasia_scale i.euthanasia_gender
eststo main_euthanasia
margins, over(euthanasia_gender) pwcompare(effects) //Female and Male expert differ from control group, but not from each other
	*Graph
	estimates restore main_euthanasia
	margins, at(euthanasia_gender=0) post
	eststo eu_m0
	estimates restore main_euthanasia
	margins, at(euthanasia_gender=1) post
	eststo eu_m1
	estimates restore main_euthanasia
	margins, at(euthanasia_gender=2) post
	eststo eu_m2
	coefplot(eu_m0, label(Control) msymbol(smdiamond)) ///
			(eu_m1, label(Male expert) msymbol(circle) color(black) ciopts(color(black))) ///
			(eu_m2, label(Female expert) msymbol(circle_hollow) color(black) ciopts(color(black))) ///
			, vert legend(rows(1) position(12)) msize(vlarge) ///
			title("Euthanasia Experiment", size(large)) ytitle("Opinion on Euthanasia", size(large)) xtitle(" ") ///
			coeflabels(, nolabel notick) level(95) ylabel(, labsize(large) labcolor(black))
			graph save  eutha_att_main.gph, replace 


	*Age as moderator*
	reg euthanasia_scale ib1.euthanasia_gender##c.age //no significant interaction with respondent age (male expert as reference category)
	estimates store age_euthanasia
	margins, dydx(euthanasia_gender) at(age=(20(1)80))   //difference between attitude after exposure to male vs. female expert is insignificant for all ages
		*Graph
		estimate restore age_euthanasia
		margins, at (age=(20(5)80) euthanasia_gender=(0)) post
		eststo eu_a0
		estimate restore age_euthanasia
		margins, at (age=(20(5)80) euthanasia_gender=(1)) post
		eststo eu_a1
		estimate restore age_euthanasia
		margins, at (age=(20(5)80) euthanasia_gender=(2)) post
		eststo eu_a2
		coefplot(eu_a0, label(Control) msymbol(smdiamond) color(black) ciopts(color(black))) ///
				(eu_a1, label(Male expert) msymbol(circle) color(black) ciopts(color(black))) ///
				(eu_a2, label(Female expert) msymbol(circle_hollow) color(black) ciopts(color(black))) ///
				, vert legend(rows(1) position(12)) msize(large) ///
				title("Euthanasia Experiment", size(large)) ytitle("Opinion on Euthanasia", size(large)) xtitle("Age (20-80 years)", size(large) color(black)) ///
				coeflabels(, notick nolabels)  level(95) ylabel(, labsize(large) labcolor(black))
				graph save  eutha_att_age.gph, replace 
		
		
		*Additional check: non-linear effects of age
		reg euthanasia_scale ib1.euthanasia_gender##age_grp //no significant interaction with respondent age category (male expert as reference category)
		estimates store agegrp_euthanasia
		margins, dydx(euthanasia_gender) at(age_grp=(1 2 3 4)) //difference between attitude after exposure to male vs. female expert is insignificant for all age groups
			*Graph
			estimate restore agegrp_euthanasia
			margins, at (age_grp=(1 2 3 4) euthanasia_gender=(0)) post
			eststo eu_ag0
			estimate restore agegrp_euthanasia
			margins, at (age_grp=(1 2 3 4) euthanasia_gender=(1)) post
			eststo eu_ag1
			estimate restore agegrp_euthanasia
			margins, at (age_grp=(1 2 3 4) euthanasia_gender=(2)) post
			eststo eu_ag2
			coefplot(eu_ag0, label(Control) msymbol(smdiamond) color(black) ciopts(color(black))) ///
					(eu_ag1, label(Male expert) msymbol(circle) color(black) ciopts(color(black))) ///
					(eu_ag2, label(Female expert) msymbol(circle_hollow) color(black) ciopts(color(black))) ///
					, vert legend(rows(1) position(12)) msize(vlarge) ///
					title("Euthanasia Experiment", size(large)) ytitle("Opinion on Euthanasia", size(large)) xtitle(" " "Age groups", size(large)) ///
					coeflabels(1._at="18-34" 2._at="35-49" 3._at="50-64" 4._at="65+" , labsize(large) labcolor(black)) ylabel(, labsize(large) labcolor(black))
					graph save  eutha_att_agegrp.gph, replace 
								

	*Gender as moderator*
	reg euthanasia_scale ib1.euthanasia_gender##i.female //no significant interaction with respondent gender (male expert as reference category)
	estimates store gender_euthanasia
	margins, dydx(euthanasia_gender) at(female=(0 1)) // difference between male expert ("1.euthanasia_gender") and female expert (2.euthanasia_gender ) insignificant for men ("female=0) and women ("female=1")
		*Graph
		estimates restore gender_euthanasia
		margins, at(female=(0 1) euthanasia_gender=(0) ) post
		eststo eu_g0
		estimates restore gender_euthanasia
		margins, at(female=(0 1) euthanasia_gender=(1) ) post
		eststo eu_g1
		estimates restore gender_euthanasia
		margins, at(female=(0 1) euthanasia_gender=(2) ) post
		eststo eu_g2
		
		coefplot(eu_g0, label(Control) msymbol(smdiamond) color(black) ciopts(color(black)) mlabels(1._at = 3 "Control" 2._at = 3 "Control" ) ) ///
				(eu_g1, label(Male expert) msymbol(circle) color(black) ciopts(color(black))) ///
				(eu_g2, label(Female expert) msymbol(circle_hollow) color(black) ciopts(color(black))) ///
				, vert order(1._at . 2._at) legend(rows(1) position(12)) msize(vlarge)  ///
				title("Euthanasia Experiment", size(large)) ytitle("Opinion on Euthanasia", size(large)) ///
				coeflabels( 1._at = `""Male" "respondent""' 2._at=`""Female" "respondent""', labsize(large) labcolor(black)) level(95)
				graph save  eutha_att_gender.gph, replace 
	
	
	*Education as moderator
	reg euthanasia_scale ib1.euthanasia_gender##i.edu3 //no significant interaction with respondent gender (male expert as reference category)
	estimates store edu_euthanasia
	margins, dydx( euthanasia_gender) at(edu3=(1 2 3)) //difference between attitude after exposure to male vs. female expert is insignificant for all levels of education
		*Graph
		estimate restore edu_euthanasia
		margins, at(edu3=(1 2 3) euthanasia_gender=(0) ) post
		eststo eu_ed0
		estimates restore edu_euthanasia
		margins, at(edu3=(1 2 3) euthanasia_gender=(1) ) post
		eststo eu_ed1
		estimates restore edu_euthanasia
		margins, at(edu3=(1 2 3) euthanasia_gender=(2) ) post
		eststo eu_ed2
		
		coefplot(eu_ed0, label(Control) msymbol(smdiamond) color(black) ciopts(color(black))) ///
				(eu_ed1, label(Male expert) msymbol(circle) color(black) ciopts(color(black))) ///
				(eu_ed2, label(Female expert) msymbol(circle_hollow) color(black) ciopts(color(black))) ///
				, vert order(1._at . 2._at . 3._at) legend(rows(1) position(12)) msize(vlarge) ///
				title("Euthanasia Experiment", size(large)) ytitle("Opinion on Euthanasia", size(large)) ///
				coeflabels( 1._at = `""High school" "or less""' 2._at="Vocational" 3._at= `""Some" "College""' , labsize(large) labcolor(black)) level(95) ylabel(, labsize(large) labcolor(black))
				graph save  eutha_att_edu.gph, replace 
				
				
	*Occupation as moderator
	reg euthanasia_scale ib1.euthanasia_gender##i.occu5 //no significant interaction with respondent gender (male expert as reference category)
	estimates store occu5_euthanasia
	margins, dydx(euthanasia_gender) at(occu5=(1 2 3 4 5)) //difference between attitude after exposure to male vs. female expert is significant among retired and marginally significant among white collar
	margins, by(euthanasia_gender occu5) pwcompare
	
		*Graph
		estimate restore occu5_euthanasia
		margins, at(occu5=(1 2 3 4 5) euthanasia_gender=(0) ) post
		eststo eu_oc0
		estimates restore occu5_euthanasia
		margins, at(occu5=(1 2 3 4 5) euthanasia_gender=(1) ) post
		eststo eu_oc1
		estimates restore occu5_euthanasia
		margins, at(occu5=(1 2 3 4 5) euthanasia_gender=(2) ) post
		eststo eu_oc2
		
		coefplot(eu_oc0, label(Control) msymbol(smdiamond) color(black) ciopts(color(black))) ///
				(eu_oc1, label(Male expert) msymbol(circle) color(black) ciopts(color(black))) ///
				(eu_oc2, label(Female expert) msymbol(circle_hollow) color(black) ciopts(color(black))) ///
				, vert order(1._at . 2._at . 3._at . 4._at . 5._at) legend(rows(1) position(12)) msize(vlarge) ///
				title("Euthanasia Experiment", size(large)) ytitle("Opinion on Euthanasia", size(large)) ///
				coeflabels( 1._at = `""Blue" "collar""' 2._at=`""White" "collar""' 3._at= `""Student/" "Intern""' 4._at= "Retired" 5._at= `""Unempl./" "Other""' ,  labsize(medlarge) labcolor(black)) ///
				ylabel(, labsize(large) labcolor(black)) level(95)
				graph save  eutha_att_occu.gph, replace				
					
				
				
	***************************************************
	*** Entrepreneurship experiment: Policy opinion ***
	***************************************************

*Main effect*
reg entrepreneurship_scale i.entrepreneurship_gender
eststo main_entrepreneurship
margins, over(entrepreneurship_gender) pwcompare(effects) //Female and Male expert differ from control group, but not from each other
	*Graph
	estimates restore main_entrepreneurship
	margins, at(entrepreneurship_gender=0) post
	eststo en_m0
	estimates restore main_entrepreneurship
	margins, at(entrepreneurship_gender=1) post
	eststo en_m1
	estimates restore main_entrepreneurship
	margins, at(entrepreneurship_gender=2) post
	eststo en_m2
	coefplot(en_m0, label(Control) msymbol(smdiamond) color(black) ciopts(color(black))) ///
			(en_m1, label(Male expert) msymbol(circle) color(black) ciopts(color(black))) ///
			(en_m2, label(Female expert) msymbol(circle_hollow) color(black) ciopts(color(black))) ///
			, vert legend(rows(1) position(12)) msize(vlarge) ///
			title("Entrepreneurship Experiment", size(large)) ytitle("Opinion on Entrepreneurship", size(large)) xtitle("") ///
			coeflabels(, nolabel notick) level(95) ylabel(, labsize(large) labcolor(black))
			graph save  entre_att_main.gph, replace 

		
			
			
*Model used for subsequent analyses of moderation*
reg entrepreneurship_scale i.entrepreneurship_gender##c.age i.entrepreneurship_gender##i.female i.entrepreneurship_gender##i.edu3 
estimate store interactionmodel_entrepr


	*Age as moderator*
	reg entrepreneurship_scale ib1.entrepreneurship_gender##c.age //no significant interaction with respondent age (male expert as reference category)
	estimates store age_entrepreneurship
	margins, dydx(entrepreneurship_gender) at(age=(20(1)80))   //difference between attitude after exposure to male vs. female expert is insignificant for all ages
		*Graph
		estimate restore age_entrepreneurship
		margins, at (age=(20(5)80) entrepreneurship_gender=(0)) post
		eststo en_a0
		estimate restore age_entrepreneurship
		margins, at (age=(20(5)80) entrepreneurship_gender=(1)) post
		eststo en_a1
		estimate restore age_entrepreneurship
		margins, at (age=(20(5)80) entrepreneurship_gender=(2)) post
		eststo en_a2
		coefplot(en_a0, label(Control) msymbol(smdiamond) color(black) ciopts(color(black))) ///
				(en_a1, label(Male expert) msymbol(circle) color(black) ciopts(color(black))) ///
				(en_a2, label(Female expert) msymbol(circle_hollow) color(black) ciopts(color(black))) ///
				, vert legend(rows(1) position(12)) msize(vlarge) msize(vlarge) ///
				title("Entrepreneurship Experiment", size(large)) ytitle("Opinion on Entrepreneurship", size(large)) xtitle("Age (20-80 years)", size(large) color(black)) level(95) ///
				coeflabels(, notick nolabels)
				graph save  entre_att_age.gph, replace 
	
				
		reg entrepreneurship_scale ib1.entrepreneurship_gender##age_grp 
		estimates store agegrp_entrepreneurship
		margins, dydx(entrepreneurship_gender) at(age_grp=(1 2 3 4)) //difference between attitude after exposure to male vs. female expert is insignificant for all age groups
			*Graph
			estimate restore agegrp_entrepreneurship
			margins, at (age_grp=(1 2 3 4) entrepreneurship_gender=(0)) post
			eststo en_ag0
			estimate restore agegrp_entrepreneurship
			margins, at (age_grp=(1 2 3 4) entrepreneurship_gender=(1)) post
			eststo en_ag1
			estimate restore agegrp_entrepreneurship
			margins, at (age_grp=(1 2 3 4) entrepreneurship_gender=(2)) post
			eststo en_ag2
			coefplot(en_ag0, label(Control) msymbol(smdiamond) color(black) ciopts(color(black))) ///
					(en_ag1, label(Male expert) msymbol(circle) color(black) ciopts(color(black))) ///
					(en_ag2, label(Female expert) msymbol(circle_hollow) color(black) ciopts(color(black))) ///
					, vert legend(rows(1) position(12))  msize(vlarge) ///
					title("Entrepreneurship Experiment", size(large)) ytitle("Opinion on entrepreneurship", size(large)) xtitle(" " "Age groups", size(large) color(black)) ///
					coeflabels(1._at="18-34" 2._at="35-49" 3._at="50-64" 4._at="65+" , labsize(large) labcolor(black)) ylabel(, labsize(large) labcolor(black))level(95)
					graph save  entre_att_agegrp.gph, replace 


	*Gender as moderator*
	reg entrepreneurship_scale ib1.entrepreneurship_gender##i.female //no significant interaction with respondent gender (male expert as reference category)
	estimates store gender_entrepreneurship
	margins, dydx(entrepreneurship_gender) at(female=(0 1)) // difference between male expert ("1.entrepreneurship_gender") and female expert ("2.entrepreneurship_gender") insignificant for men ("female=0) and women ("female=1")
		*Graph
		estimates restore gender_entrepreneurship
		margins, at(female=(0 1) entrepreneurship_gender=(0) ) post
		eststo en_g0
		estimates restore gender_entrepreneurship
		margins, at(female=(0 1) entrepreneurship_gender=(1) ) post
		eststo en_g1
		estimates restore gender_entrepreneurship
		margins, at(female=(0 1) entrepreneurship_gender=(2) ) post
		eststo en_g2
		coefplot(en_g0, label(Control) msymbol(smdiamond) mlabels(1._at = 3 "Control" 2._at = 3 "Control" ) color(black) ciopts(color(black))) ///
				(en_g1, label(Male expert) msymbol(circle) color(black) ciopts(color(black))) ///
				(en_g2, label(Female expert) msymbol(circle_hollow) color(black) ciopts(color(black))) ///
				, vert order(1._at . 2._at) legend(rows(1) position(12)) msize(vlarge) ///
				title("Entrepreneurship Experiment", size(large)) ytitle("Opinion on Entrepreneurship", size(large) color(black)) ///
				coeflabels( 1._at = `""Male" "respondent""' 2._at=`""Female" "respondent""', labsize(large) labcolor(black)) level(95)
				graph save entre_att_gender.gph, replace
	

	*Education as moderator
	reg entrepreneurship_scale ib1.entrepreneurship_gender##i.edu3 //no significant interaction with respondent gender (male expert as reference category)
	estimates store edu_entrepreneurship
	margins, dydx( entrepreneurship_gender) at(edu3=(1 2 3)) //difference between attitude after exposure to male vs. female expert is insignificant for all levels of education
		*Graph
		estimate restore edu_entrepreneurship
		margins, at(edu3=(1 2 3) entrepreneurship_gender=(0) ) post
		eststo en_ed1
		estimates restore edu_entrepreneurship
		margins, at(edu3=(1 2 3) entrepreneurship_gender=(1) ) post
		eststo en_ed2
		estimates restore edu_entrepreneurship
		margins, at(edu3=(1 2 3) entrepreneurship_gender=(2) ) post
		eststo en_ed3
		
		coefplot(en_ed1, label(Control) msymbol(smdiamond) color(black) ciopts(color(black))) ///
				(en_ed2, label(Male expert) msymbol(circle) color(black) ciopts(color(black))) ///
				(en_ed3, label(Female expert) msymbol(circle_hollow) color(black) ciopts(color(black))) ///
				, vert order(1._at . 2._at . 3._at) legend(rows(1) position(12)) msize(vlarge) ///
				title("Entrepreneurship Experiment", size(large)) ytitle("Opinion on entrepreneurship", size(large)) ///
				coeflabels( 1._at = `""High school" "or less""' 2._at="Vocational" 3._at= `""Some" "College""' , labsize(large) labcolor(black)) level(95) ylabel(, labsize(large) labcolor(black))
				graph save  entre_att_edu.gph, replace
	
	
	
	*Occupation as moderator
	reg entrepreneurship_scale ib1.entrepreneurship_gender##i.occu5 //no significant interaction with respondent gender (male expert as reference category)
	estimates store occu5_entrepreneurship
	margins, dydx(entrepreneurship_gender) at(occu5=(1 2 3 4 5)) //difference between attitude after exposure to male vs. female expert is insignificant for all occupational groups
		*Graph
		estimate restore occu5_entrepreneurship
		margins, at(occu5=(1 2 3 4 5) entrepreneurship_gender=(0) ) post
		eststo en_oc0
		estimates restore occu5_entrepreneurship
		margins, at(occu5=(1 2 3 4 5) entrepreneurship_gender=(1) ) post
		eststo en_oc1
		estimates restore occu5_entrepreneurship
		margins, at(occu5=(1 2 3 4 5) entrepreneurship_gender=(2) ) post
		eststo en_oc2
		
		coefplot(en_oc0, label(Control) msymbol(smdiamond) color(black) ciopts(color(black))) ///
				(en_oc1, label(Male expert) msymbol(circle) color(black) ciopts(color(black))) ///
				(en_oc2, label(Female expert) msymbol(circle_hollow) color(black) ciopts(color(black))) ///
				, vert order(1._at . 2._at . 3._at . 4._at . 5._at) legend(rows(1) position(12)) msize(vlarge) ///
				title("Entrepreneurship Experiment", size(large)) ytitle("Opinion on entrepreneurship", size(large)) ///
				coeflabels( 1._at = `""Blue" "collar""' 2._at=`""White" "collar""' 3._at= `""Student/" "Intern""' 4._at= "Retired" 5._at= `""Unempl./" "Other""' ,  labsize(medlarge) labcolor(black)) ///
				ylabel(, labsize(large) labcolor(black)) level(95) 
				graph save  entre_att_occu.gph, replace
				
					
*************************
****** EFFECT SIZE ******
*************************

* Generating scale variables, where control is set to NA, in order to calculate effect size between the two treatment groups.
gen euthanasia_scale_dummy = euthanasia_scale if euthanasia_gender > 0 // as control condition = 0
gen entrepreneurship_scale_dummy = entrepreneurship_scale if entrepreneurship_gender > 0 // as control condition = 0
codebook euthanasia_scale_dummy entrepreneurship_scale, tab(100)

** Euthanasia
* ISSUE: TREATMENT VS. CONTROL
reg euthanasia_scale i.eutha_control_vs_gender
eststo exp_euthanasia
esize twosample euthanasia_scale, by(eutha_control_vs_gender) hedgesg // hedge's g = -.2699558, [-.3628783 ; -.1770334]
bootstrap r(g), reps(1000) nowarn seed(111):  esize twosample euthanasia_scale, by(eutha_control_vs_gender) // bootstrap to correct for non-normal distribution.

* COMPETENCE: MALE TREATMENT VS FEMALE TREATMENT
reg euthanasia_competence_scale ib1.euthanasia_gender
esize twosample euthanasia_competence_scale, by(euthanasia_gender) hedgesg // hedge's g = .0198154 [-.1091887 ; .1488087]
bootstrap r(g), reps(1000) nowarn seed(111): esize twosample euthanasia_competence_scale, by(euthanasia_gender) // bootstrap to correct for non-normal distribution.

* ISSUE: MALE VS FEMALE TREATMENT
reg euthanasia_scale_dummy ib(1).euthanasia_gender
esize twosample euthanasia_scale_dummy, by(euthanasia_gender) hedgesg // hedge's g = .0356059 [-.0895356 ; .1607293]
bootstrap r(g), reps(1000) nowarn seed(111): esize twosample euthanasia_scale_dummy, by(euthanasia_gender) // bootstrap to correct for non-normal distribution.

** Entrepreneurship 
* ISSUE: TREATMENT VS. CONTROL
reg entrepreneurship_scale i.entre_control_vs_gender
eststo exp_entrepreneurship
esize twosample entrepreneurship_scale, by(entre_control_vs_gender) hedgesg // hedge's g = -.6977453 [-.7888976 ; -.6064243]
bootstrap r(g), reps(1000) nowarn seed(111):  esize twosample entrepreneurship_scale, by(entre_control_vs_gender) // bootstrap to correct for non-normal distribution.

* COMPETENCE: MALE TREATMENT VS FEMALE TREATMENT
reg entrepreneur_competence_scale ib1.entrepreneurship_gender
esize twosample entrepreneur_competence_scale, by(entrepreneurship_gender) hedgesg // hedge's g = -.0131278 [-.1432687 ; .1170204]
bootstrap r(g), reps(1000) nowarn seed(111): esize twosample entrepreneur_competence_scale, by(entrepreneurship_gender) // bootstrap to correct for non-normal distribution.

* ISSUE: MALE VS FEMALE TREATMENT
reg entrepreneurship_scale_dummy ib(1).entrepreneurship_gender
esize twosample entrepreneurship_scale_dummy, by(entrepreneurship_gender) hedgesg // hedge's g = .0350267 [-.0899412 ; .1599768]
bootstrap r(g), reps(1000) nowarn seed(111): esize twosample entrepreneurship_scale_dummy, by(entrepreneurship_gender) // bootstrap to correct for non-normal distribution.



**************************					
***FIGURES****************					
**************************

*** FIGURE 1: Perceived competence (main) ***
*Main
grc1leg eutha_comp_main.gph entre_comp_main.gph, ycommon position(6) title(" " " " " ", size(medium)) /// 
	note(" " "Note: Mean competence of the expert conditional on treatment (with 95% confidence intervals)" ///
		"Based on models 5 and 6", size(medsmall))	
	graph export fig1_competence_main.tif, replace

*** FIGURE 2: Policy opinion (main) ***
grc1leg eutha_att_main.gph entre_att_main.gph, ycommon position(6) title(" " " " " ", size(medium)) ///
	note(" " "Note: Mean policy opinion conditional on the experimental treatment (with 95% confidence intervals)" ///
		"Based on models 2 and 4", size(medsmall))
	graph export fig2_attitude_main.tif, replace

*** FIGURE 3: Perceived competence moderated by respondent gender
grc1leg eutha_comp_gender.gph entre_comp_gender.gph, ycommon position(6)  title(" " " " " ", size(medium))  ///
	note(" " "Note: Mean competence conditional on treatment and respondent gender (with 95% confidence intervals)" ///
		"Based on models 9 and 14", size(medsmall))	
	graph export fig3_competence_gender.tif, replace

*** FIGURE 4: Policy opinion moderated by respondent gender
grc1leg  eutha_att_gender.gph entre_att_gender.gph, ycommon position(6) title(" " " " " ", size(medium)) ///
	note(" " "Note: Mean policy opinion conditional on treatment and respondent gender (with 95% confidence intervals)"  ///
			"Based on models 19 and 24", size(medsmall))	
	graph export fig4_attitude_gender.tif, replace

	
	
**************************************
********** APPENDIX FIGURES **********
**************************************


	*****************************************
	***** CONDITIONAL TREATMENT EFFECTS *****
	*****************************************

		**********************
		*** POLICY OPINION ***
		**********************

*Age
grc1leg eutha_att_age.gph entre_att_age.gph, ycommon position(6)  title(" " "Figure A2: Policy Opinion, Experimental Treatment and Respondents' Age" " ", size(medium)) ///
	note(" " "Note: Mean policy opinion conditional on treatment and respondent age (with 95% confidence intervals)" ///
			"Based on models 17 and 22" , size(medsmall))
	graph export attitude_age.tif, replace
	
*Age group
	grc1leg eutha_att_agegrp.gph entre_att_agegrp.gph, ycommon position(6)  title(" " "Figure A3: Policy Opinion, Experimental Treatment and Respondents' Age Group" " ", size(medium)) ///
		note(" " "Note: Mean policy opinion conditional on treatment and respondent age group(with 95% confidence intervals)" ///
			"Based on models 18 and 23" ,size(medsmall))
	graph export attitude_age_grp.tif, replace

*Education		
grc1leg  eutha_att_edu.gph entre_att_edu.gph, ycommon position(6) title(" " "Figure A4: Policy Opinion, Experimental Treatment and Respondents' Education" " ", size(medium)) ///
	note(" " "Note: Mean policy opinion conditional on treatment and respondent education (with 95% confidence intervals)"  ///
		"Based on models 20 and 25" ,size(medsmall))		
	graph export attitude_education.tif, replace

*Occupation
grc1leg  eutha_att_occu.gph entre_att_occu.gph, ycommon position(6) title(" " "Figure A5: Policy Opinion, Experimental Treatment and Respondents' Occupation" " ", size(medium)) ///
	note(" " "Note: Mean policy opinion conditional on treatment and respondent occupation (with 95% confidence intervals)" ///
	"Based on models 21 and 26", size(medsmall))			
	graph export attitude_occupation.tif, replace	


****************************
*** PERCEIVED COMPETENCE ***
****************************

*Age
grc1leg eutha_comp_age.gph entre_comp_age.gph, ycommon position(6)  title(" " "Figure A6: Perceived Competence, Experimental Treatment and Respondents' Age" " ", size(medium)) ///
	note(" " "Note: Mean competence conditional on treatment and respondent age (with 95% confidence intervals)" ///
	"Based on models 7 and 12", size(medsmall))
	graph export competence_age.tif, replace

*Age group
grc1leg eutha_comp_agegrp.gph entre_comp_agegrp.gph, ycommon position(6)  title(" " "Figure A7: Perceived Competence, Experimental Treatment and Respondents' Age Group" " ", size(medium)) ///
	note(" " "Note: Mean competence conditional on treatment and respondent age group (95% confidence intervals)" ///
	"Based on models 8 and 13", size(medsmall))
	graph export competence_age_grp.tif, replace
	
*Education		
grc1leg  eutha_comp_edu.gph entre_comp_edu.gph, ycommon position(6) title(" " "Figure A8: Perceived Competence, Experimental Treatment and Respondents' Education" " ", size(medium)) ///
	note(" " "Note: Mean competence conditional on treatment and respondent education (with 95% confidence intervals)" ///
	"Based on models 10 and 15", size(medsmall))		
	graph export competence_education.tif, replace
	
*Occupation
grc1leg  eutha_comp_occu.gph entre_comp_occu.gph, ycommon position(6) title(" " "Figure A9: Perceived Competence, Experimental Treatment and Respondents' Occupation" " ", size(medium)) ///
	note(" " "Note: Mean competence conditional on treatment and respondent occupation (with 95% confidence intervals)" ///
	"Based on models 11 and 16", size(medsmall))			 
	graph export competence_occupation.tif, replace
	

********* Outcome density plots************
grc1leg density_eutha_comp.gph density_entre_comp.gph, ycommon position(6) title(" " "Figure A10: Density plots for competence measure" " ", size(medium)) ///
	note(, size(medlarge))			
	graph export density_comp.tif, replace

grc1leg  density_eutha_att.gph density_entre_att.gph, ycommon position(6) title(" " "Figure A11: Density plots for Policy Opinion measures" " ", size(medium)) ///
	note(, size(medlarge))			
	graph export density_attitude.tif, replace

*Erasing temporary graphs
cd "C:\no_gender_bias"
!del *gph // Make sure that you are in the right directory when running this line. It will delete all Stata graphs in directory!
	
************
***TABLES***
************

esttab exp_euthanasia		main_euthanasia 		using table_euthanasia_attitude.rtf			, r2 b(2) se(2) nobase wide label replace title("Euthanasia, Attitude") coeflabels(_cons "Constant")
esttab exp_entrepreneurship	main_entrepreneurship 	using table_entrepreneurship_attitude.rtf	, r2 b(2) se(2) nobase wide label replace title("Entrepeneurship, Attitude") coeflabels(_cons "Constant")
esttab 	main_eutha_comp 							using table_euthanasia_competence.rtf 		, r2 b(2) se(2) nobase wide label replace title("Euthanasia, Competence") coeflabels(_cons "Constant")
esttab main_entr_comp 								using table_entrepreneurship_competence.rtf	, r2 b(2) se(2) nobase wide label replace title("Entrepreneurship, Competence") coeflabels(_cons "Constant")

esttab age_euthanasia agegrp_euthanasia gender_euthanasia edu_euthanasia occu5_euthanasia ///
											using table_euthanasia_mod_attitude.rtf			, r2 b(2) se(2) nobase wide label replace title("Euthanasia, Attitude interactions") coeflabels(_cons "Constant")
esttab age_entrepreneurship agegrp_entrepreneurship gender_entrepreneurship edu_entrepreneurship occu5_entrepreneurship ///
											using table_entrepreneurship_mod_attitude.rtf			, r2 b(2) se(2) nobase wide label replace title("Entrepreneurship, Attitude interactions") coeflabels(_cons "Constant")
			
esttab age_eutha_comp agegrp_comp_eutha gender_eutha_comp edu_eutha_comp occu5_eutha_comp ///
											using table_euthanasia_mod_competence.rtf 		, r2 b(2) se(2) nobase wide label replace title("Euthanasia, Competence interactions") coeflabels(_cons "Constant")
esttab age_entre_comp agegrp_comp_enter gender_entre_comp edu_entre_comp occu5_entre_comp ///
											using table_entre_mod_competence.rtf 		, r2 b(2) se(2) nobase wide label replace title("Entrepreneurship, Competence interactions") coeflabels(_cons "Constant")
			
*****************************
********** THE END **********
*****************************
